home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261a.zoo / info / gcc.info-21 < prev    next >
Encoding:
GNU Info File  |  1994-10-31  |  44.4 KB  |  997 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. File: gcc.info,  Node: Condition Code,  Next: Costs,  Prev: Addressing Modes,  Up: Target Macros
  31.  
  32. Condition Code Status
  33. =====================
  34.  
  35.    The file `conditions.h' defines a variable `cc_status' to describe
  36. how the condition code was computed (in case the interpretation of the
  37. condition code depends on the instruction that it was set by).  This
  38. variable contains the RTL expressions on which the condition code is
  39. currently based, and several standard flags.
  40.  
  41.    Sometimes additional machine-specific flags must be defined in the
  42. machine description header file.  It can also add additional
  43. machine-specific information by defining `CC_STATUS_MDEP'.
  44.  
  45. `CC_STATUS_MDEP'
  46.      C code for a data type which is used for declaring the `mdep'
  47.      component of `cc_status'.  It defaults to `int'.
  48.  
  49.      This macro is not used on machines that do not use `cc0'.
  50.  
  51. `CC_STATUS_MDEP_INIT'
  52.      A C expression to initialize the `mdep' field to "empty".  The
  53.      default definition does nothing, since most machines don't use the
  54.      field anyway.  If you want to use the field, you should probably
  55.      define this macro to initialize it.
  56.  
  57.      This macro is not used on machines that do not use `cc0'.
  58.  
  59. `NOTICE_UPDATE_CC (EXP, INSN)'
  60.      A C compound statement to set the components of `cc_status'
  61.      appropriately for an insn INSN whose body is EXP.  It is this
  62.      macro's responsibility to recognize insns that set the condition
  63.      code as a byproduct of other activity as well as those that
  64.      explicitly set `(cc0)'.
  65.  
  66.      This macro is not used on machines that do not use `cc0'.
  67.  
  68.      If there are insns that do not set the condition code but do alter
  69.      other machine registers, this macro must check to see whether they
  70.      invalidate the expressions that the condition code is recorded as
  71.      reflecting.  For example, on the 68000, insns that store in address
  72.      registers do not set the condition code, which means that usually
  73.      `NOTICE_UPDATE_CC' can leave `cc_status' unaltered for such insns.
  74.      But suppose that the previous insn set the condition code based
  75.      on location `a4@(102)' and the current insn stores a new value in
  76.      `a4'.  Although the condition code is not changed by this, it will
  77.      no longer be true that it reflects the contents of `a4@(102)'.
  78.      Therefore, `NOTICE_UPDATE_CC' must alter `cc_status' in this case
  79.      to say that nothing is known about the condition code value.
  80.  
  81.      The definition of `NOTICE_UPDATE_CC' must be prepared to deal with
  82.      the results of peephole optimization: insns whose patterns are
  83.      `parallel' RTXs containing various `reg', `mem' or constants which
  84.      are just the operands.  The RTL structure of these insns is not
  85.      sufficient to indicate what the insns actually do.  What
  86.      `NOTICE_UPDATE_CC' should do when it sees one is just to run
  87.      `CC_STATUS_INIT'.
  88.  
  89.      A possible definition of `NOTICE_UPDATE_CC' is to call a function
  90.      that looks at an attribute (*note Insn Attributes::.) named, for
  91.      example, `cc'.  This avoids having detailed information about
  92.      patterns in two places, the `md' file and in `NOTICE_UPDATE_CC'.
  93.  
  94. `EXTRA_CC_MODES'
  95.      A list of names to be used for additional modes for condition code
  96.      values in registers (*note Jump Patterns::.).  These names are
  97.      added to `enum machine_mode' and all have class `MODE_CC'.  By
  98.      convention, they should start with `CC' and end with `mode'.
  99.  
  100.      You should only define this macro if your machine does not use
  101.      `cc0' and only if additional modes are required.
  102.  
  103. `EXTRA_CC_NAMES'
  104.      A list of C strings giving the names for the modes listed in
  105.      `EXTRA_CC_MODES'.  For example, the Sparc defines this macro and
  106.      `EXTRA_CC_MODES' as
  107.  
  108.           #define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
  109.           #define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
  110.  
  111.      This macro is not required if `EXTRA_CC_MODES' is not defined.
  112.  
  113. `SELECT_CC_MODE (OP, X, Y)'
  114.      Returns a mode from class `MODE_CC' to be used when comparison
  115.      operation code OP is applied to rtx X and Y.  For example, on the
  116.      Sparc, `SELECT_CC_MODE' is defined as (see *note Jump Patterns::.
  117.      for a description of the reason for this definition)
  118.  
  119.           #define SELECT_CC_MODE(OP,X,Y) \
  120.             (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
  121.              ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
  122.              : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
  123.                  || GET_CODE (X) == NEG) \
  124.                 ? CC_NOOVmode : CCmode))
  125.  
  126.      You need not define this macro if `EXTRA_CC_MODES' is not defined.
  127.  
  128. `CANONICALIZE_COMPARISON (CODE, OP0, OP1)'
  129.      One some machines not all possible comparisons are defined, but
  130.      you can convert an invalid comparison into a valid one.  For
  131.      example, the Alpha does not have a `GT' comparison, but you can
  132.      use an `LT' comparison instead and swap the order of the operands.
  133.  
  134.      On such machines, define this macro to be a C statement to do any
  135.      required conversions.  CODE is the initial comparison code and OP0
  136.      and OP1 are the left and right operands of the comparison,
  137.      respectively.  You should modify CODE, OP0, and OP1 as required.
  138.  
  139.      GNU CC will not assume that the comparison resulting from this
  140.      macro is valid but will see if the resulting insn matches a
  141.      pattern in the `md' file.
  142.  
  143.      You need not define this macro if it would never change the
  144.      comparison code or operands.
  145.  
  146. `REVERSIBLE_CC_MODE (MODE)'
  147.      A C expression whose value is one if it is always safe to reverse a
  148.      comparison whose mode is MODE.  If `SELECT_CC_MODE' can ever
  149.      return MODE for a floating-point inequality comparison, then
  150.      `REVERSIBLE_CC_MODE (MODE)' must be zero.
  151.  
  152.      You need not define this macro if it would always returns zero or
  153.      if the floating-point format is anything other than
  154.      `IEEE_FLOAT_FORMAT'.  For example, here is the definition used on
  155.      the Sparc, where floating-point inequality comparisons are always
  156.      given `CCFPEmode':
  157.  
  158.           #define REVERSIBLE_CC_MODE(MODE)  ((MODE) != CCFPEmode)
  159.  
  160. File: gcc.info,  Node: Costs,  Next: Sections,  Prev: Condition Code,  Up: Target Macros
  161.  
  162. Describing Relative Costs of Operations
  163. =======================================
  164.  
  165.    These macros let you describe the relative speed of various
  166. operations on the target machine.
  167.  
  168. `CONST_COSTS (X, CODE, OUTER_CODE)'
  169.      A part of a C `switch' statement that describes the relative costs
  170.      of constant RTL expressions.  It must contain `case' labels for
  171.      expression codes `const_int', `const', `symbol_ref', `label_ref'
  172.      and `const_double'.  Each case must ultimately reach a `return'
  173.      statement to return the relative cost of the use of that kind of
  174.      constant value in an expression.  The cost may depend on the
  175.      precise value of the constant, which is available for examination
  176.      in X, and the rtx code of the expression in which it is contained,
  177.      found in OUTER_CODE.
  178.  
  179.      CODE is the expression code--redundant, since it can be obtained
  180.      with `GET_CODE (X)'.
  181.  
  182. `RTX_COSTS (X, CODE, OUTER_CODE)'
  183.      Like `CONST_COSTS' but applies to nonconstant RTL expressions.
  184.      This can be used, for example, to indicate how costly a multiply
  185.      instruction is.  In writing this macro, you can use the construct
  186.      `COSTS_N_INSNS (N)' to specify a cost equal to N fast
  187.      instructions.  OUTER_CODE is the code of the expression in which X
  188.      is contained.
  189.  
  190.      This macro is optional; do not define it if the default cost
  191.      assumptions are adequate for the target machine.
  192.  
  193. `ADDRESS_COST (ADDRESS)'
  194.      An expression giving the cost of an addressing mode that contains
  195.      ADDRESS.  If not defined, the cost is computed from the ADDRESS
  196.      expression and the `CONST_COSTS' values.
  197.  
  198.      For most CISC machines, the default cost is a good approximation
  199.      of the true cost of the addressing mode.  However, on RISC
  200.      machines, all instructions normally have the same length and
  201.      execution time.  Hence all addresses will have equal costs.
  202.  
  203.      In cases where more than one form of an address is known, the form
  204.      with the lowest cost will be used.  If multiple forms have the
  205.      same, lowest, cost, the one that is the most complex will be used.
  206.  
  207.      For example, suppose an address that is equal to the sum of a
  208.      register and a constant is used twice in the same basic block.
  209.      When this macro is not defined, the address will be computed in a
  210.      register and memory references will be indirect through that
  211.      register.  On machines where the cost of the addressing mode
  212.      containing the sum is no higher than that of a simple indirect
  213.      reference, this will produce an additional instruction and
  214.      possibly require an additional register.  Proper specification of
  215.      this macro eliminates this overhead for such machines.
  216.  
  217.      Similar use of this macro is made in strength reduction of loops.
  218.  
  219.      ADDRESS need not be valid as an address.  In such a case, the cost
  220.      is not relevant and can be any value; invalid addresses need not be
  221.      assigned a different cost.
  222.  
  223.      On machines where an address involving more than one register is as
  224.      cheap as an address computation involving only one register,
  225.      defining `ADDRESS_COST' to reflect this can cause two registers to
  226.      be live over a region of code where only one would have been if
  227.      `ADDRESS_COST' were not defined in that manner.  This effect should
  228.      be considered in the definition of this macro.  Equivalent costs
  229.      should probably only be given to addresses with different numbers
  230.      of registers on machines with lots of registers.
  231.  
  232.      This macro will normally either not be defined or be defined as a
  233.      constant.
  234.  
  235. `REGISTER_MOVE_COST (FROM, TO)'
  236.      A C expression for the cost of moving data from a register in class
  237.      FROM to one in class TO.  The classes are expressed using the
  238.      enumeration values such as `GENERAL_REGS'.  A value of 4 is the
  239.      default; other values are interpreted relative to that.
  240.  
  241.      It is not required that the cost always equal 2 when FROM is the
  242.      same as TO; on some machines it is expensive to move between
  243.      registers if they are not general registers.
  244.  
  245.      If reload sees an insn consisting of a single `set' between two
  246.      hard registers, and if `REGISTER_MOVE_COST' applied to their
  247.      classes returns a value of 2, reload does not check to ensure that
  248.      the constraints of the insn are met.  Setting a cost of other than
  249.      2 will allow reload to verify that the constraints are met.  You
  250.      should do this if the `movM' pattern's constraints do not allow
  251.      such copying.
  252.  
  253. `MEMORY_MOVE_COST (M)'
  254.      A C expression for the cost of moving data of mode M between a
  255.      register and memory.  A value of 2 is the default; this cost is
  256.      relative to those in `REGISTER_MOVE_COST'.
  257.  
  258.      If moving between registers and memory is more expensive than
  259.      between two registers, you should define this macro to express the
  260.      relative cost.
  261.  
  262. `BRANCH_COST'
  263.      A C expression for the cost of a branch instruction.  A value of 1
  264.      is the default; other values are interpreted relative to that.
  265.  
  266.    Here are additional macros which do not specify precise relative
  267. costs, but only that certain actions are more expensive than GNU CC
  268. would ordinarily expect.
  269.  
  270. `SLOW_BYTE_ACCESS'
  271.      Define this macro as a C expression which is nonzero if accessing
  272.      less than a word of memory (i.e. a `char' or a `short') is no
  273.      faster than accessing a word of memory, i.e., if such access
  274.      require more than one instruction or if there is no difference in
  275.      cost between byte and (aligned) word loads.
  276.  
  277.      When this macro is not defined, the compiler will access a field by
  278.      finding the smallest containing object; when it is defined, a
  279.      fullword load will be used if alignment permits.  Unless bytes
  280.      accesses are faster than word accesses, using word accesses is
  281.      preferable since it may eliminate subsequent memory access if
  282.      subsequent accesses occur to other fields in the same word of the
  283.      structure, but to different bytes.
  284.  
  285. `SLOW_ZERO_EXTEND'
  286.      Define this macro if zero-extension (of a `char' or `short' to an
  287.      `int') can be done faster if the destination is a register that is
  288.      known to be zero.
  289.  
  290.      If you define this macro, you must have instruction patterns that
  291.      recognize RTL structures like this:
  292.  
  293.           (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
  294.  
  295.      and likewise for `HImode'.
  296.  
  297. `SLOW_UNALIGNED_ACCESS'
  298.      Define this macro to be the value 1 if unaligned accesses have a
  299.      cost many times greater than aligned accesses, for example if they
  300.      are emulated in a trap handler.
  301.  
  302.      When this macro is non-zero, the compiler will act as if
  303.      `STRICT_ALIGNMENT' were non-zero when generating code for block
  304.      moves.  This can cause significantly more instructions to be
  305.      produced.  Therefore, do not set this macro non-zero if unaligned
  306.      accesses only add a cycle or two to the time for a memory access.
  307.  
  308.      If the value of this macro is always zero, it need not be defined.
  309.  
  310. `DONT_REDUCE_ADDR'
  311.      Define this macro to inhibit strength reduction of memory
  312.      addresses.  (On some machines, such strength reduction seems to do
  313.      harm rather than good.)
  314.  
  315. `MOVE_RATIO'
  316.      The number of scalar move insns which should be generated instead
  317.      of a string move insn or a library call.  Increasing the value
  318.      will always make code faster, but eventually incurs high cost in
  319.      increased code size.
  320.  
  321.      If you don't define this, a reasonable default is used.
  322.  
  323. `NO_FUNCTION_CSE'
  324.      Define this macro if it is as good or better to call a constant
  325.      function address than to call an address kept in a register.
  326.  
  327. `NO_RECURSIVE_FUNCTION_CSE'
  328.      Define this macro if it is as good or better for a function to call
  329.      itself with an explicit address than to call an address kept in a
  330.      register.
  331.  
  332. `ADJUST_COST (INSN, LINK, DEP_INSN, COST)'
  333.      A C statement (sans semicolon) to update the integer variable COST
  334.      based on the relationship between INSN that is dependent on
  335.      DEP_INSN through the dependence LINK.  The default is to make no
  336.      adjustment to COST.  This can be used for example to specify to
  337.      the scheduler that an output- or anti-dependence does not incur
  338.      the same cost as a data-dependence.
  339.  
  340. File: gcc.info,  Node: Sections,  Next: PIC,  Prev: Costs,  Up: Target Macros
  341.  
  342. Dividing the Output into Sections (Texts, Data, ...)
  343. ====================================================
  344.  
  345.    An object file is divided into sections containing different types of
  346. data.  In the most common case, there are three sections: the "text
  347. section", which holds instructions and read-only data; the "data
  348. section", which holds initialized writable data; and the "bss section",
  349. which holds uninitialized data.  Some systems have other kinds of
  350. sections.
  351.  
  352.    The compiler must tell the assembler when to switch sections.  These
  353. macros control what commands to output to tell the assembler this.  You
  354. can also define additional sections.
  355.  
  356. `TEXT_SECTION_ASM_OP'
  357.      A C expression whose value is a string containing the assembler
  358.      operation that should precede instructions and read-only data.
  359.      Normally `".text"' is right.
  360.  
  361. `DATA_SECTION_ASM_OP'
  362.      A C expression whose value is a string containing the assembler
  363.      operation to identify the following data as writable initialized
  364.      data.  Normally `".data"' is right.
  365.  
  366. `SHARED_SECTION_ASM_OP'
  367.      if defined, a C expression whose value is a string containing the
  368.      assembler operation to identify the following data as shared data.
  369.      If not defined, `DATA_SECTION_ASM_OP' will be used.
  370.  
  371. `INIT_SECTION_ASM_OP'
  372.      if defined, a C expression whose value is a string containing the
  373.      assembler operation to identify the following data as
  374.      initialization code.  If not defined, GNU CC will assume such a
  375.      section does not exist.
  376.  
  377. `EXTRA_SECTIONS'
  378.      A list of names for sections other than the standard two, which are
  379.      `in_text' and `in_data'.  You need not define this macro on a
  380.      system with no other sections (that GCC needs to use).
  381.  
  382. `EXTRA_SECTION_FUNCTIONS'
  383.      One or more functions to be defined in `varasm.c'.  These
  384.      functions should do jobs analogous to those of `text_section' and
  385.      `data_section', for your additional sections.  Do not define this
  386.      macro if you do not define `EXTRA_SECTIONS'.
  387.  
  388. `READONLY_DATA_SECTION'
  389.      On most machines, read-only variables, constants, and jump tables
  390.      are placed in the text section.  If this is not the case on your
  391.      machine, this macro should be defined to be the name of a function
  392.      (either `data_section' or a function defined in `EXTRA_SECTIONS')
  393.      that switches to the section to be used for read-only items.
  394.  
  395.      If these items should be placed in the text section, this macro
  396.      should not be defined.
  397.  
  398. `SELECT_SECTION (EXP, RELOC)'
  399.      A C statement or statements to switch to the appropriate section
  400.      for output of EXP.  You can assume that EXP is either a `VAR_DECL'
  401.      node or a constant of some sort.  RELOC indicates whether the
  402.      initial value of EXP requires link-time relocations.  Select the
  403.      section by calling `text_section' or one of the alternatives for
  404.      other sections.
  405.  
  406.      Do not define this macro if you put all read-only variables and
  407.      constants in the read-only data section (usually the text section).
  408.  
  409. `SELECT_RTX_SECTION (MODE, RTX)'
  410.      A C statement or statements to switch to the appropriate section
  411.      for output of RTX in mode MODE.  You can assume that RTX is some
  412.      kind of constant in RTL.  The argument MODE is redundant except in
  413.      the case of a `const_int' rtx.  Select the section by calling
  414.      `text_section' or one of the alternatives for other sections.
  415.  
  416.      Do not define this macro if you put all constants in the read-only
  417.      data section.
  418.  
  419. `JUMP_TABLES_IN_TEXT_SECTION'
  420.      Define this macro if jump tables (for `tablejump' insns) should be
  421.      output in the text section, along with the assembler instructions.
  422.      Otherwise, the readonly data section is used.
  423.  
  424.      This macro is irrelevant if there is no separate readonly data
  425.      section.
  426.  
  427. `ENCODE_SECTION_INFO (DECL)'
  428.      Define this macro if references to a symbol must be treated
  429.      differently depending on something about the variable or function
  430.      named by the symbol (such as what section it is in).
  431.  
  432.      The macro definition, if any, is executed immediately after the
  433.      rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
  434.      The value of the rtl will be a `mem' whose address is a
  435.      `symbol_ref'.
  436.  
  437.      The usual thing for this macro to do is to record a flag in the
  438.      `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  439.      name string in the `symbol_ref' (if one bit is not enough
  440.      information).
  441.  
  442. `STRIP_NAME_ENCODING (VAR, SYM_NAME)'
  443.      Decode SYM_NAME and store the real name part in VAR, sans the
  444.      characters that encode section info.  Define this macro if
  445.      `ENCODE_SECTION_INFO' alters the symbol's name string.
  446.  
  447. File: gcc.info,  Node: PIC,  Next: Assembler Format,  Prev: Sections,  Up: Target Macros
  448.  
  449. Position Independent Code
  450. =========================
  451.  
  452.    This section describes macros that help implement generation of
  453. position independent code.  Simply defining these macros is not enough
  454. to generate valid PIC; you must also add support to the macros
  455. `GO_IF_LEGITIMATE_ADDRESS' and `PRINT_OPERAND_ADDRESS', as well as
  456. `LEGITIMIZE_ADDRESS'.  You must modify the definition of `movsi' to do
  457. something appropriate when the source operand contains a symbolic
  458. address.  You may also need to alter the handling of switch statements
  459. so that they use relative addresses.
  460.  
  461. `PIC_OFFSET_TABLE_REGNUM'
  462.      The register number of the register used to address a table of
  463.      static data addresses in memory.  In some cases this register is
  464.      defined by a processor's "application binary interface" (ABI).
  465.      When this macro is defined, RTL is generated for this register
  466.      once, as with the stack pointer and frame pointer registers.  If
  467.      this macro is not defined, it is up to the machine-dependent files
  468.      to allocate such a register (if necessary).
  469.  
  470.      findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
  471.  
  472. `PIC_OFFSET_TABLE_REG_CALL_CLOBBERED'
  473.      Define this macro if the register defined by
  474.      `PIC_OFFSET_TABLE_REGNUM' is clobbered by calls.  Do not define
  475.      this macro if `PPIC_OFFSET_TABLE_REGNUM' is not defined.
  476.  
  477. `FINALIZE_PIC'
  478.      By generating position-independent code, when two different
  479.      programs (A and B) share a common library (libC.a), the text of
  480.      the library can be shared whether or not the library is linked at
  481.      the same address for both programs.  In some of these
  482.      environments, position-independent code requires not only the use
  483.      of different addressing modes, but also special code to enable the
  484.      use of these addressing modes.
  485.  
  486.      The `FINALIZE_PIC' macro serves as a hook to emit these special
  487.      codes once the function is being compiled into assembly code, but
  488.      not before.  (It is not done before, because in the case of
  489.      compiling an inline function, it would lead to multiple PIC
  490.      prologues being included in functions which used inline functions
  491.      and were compiled to assembly language.)
  492.  
  493. `LEGITIMATE_PIC_OPERAND_P (X)'
  494.      A C expression that is nonzero if X is a legitimate immediate
  495.      operand on the target machine when generating position independent
  496.      code.  You can assume that X satisfies `CONSTANT_P', so you need
  497.      not check this.  You can also assume FLAG_PIC is true, so you need
  498.      not check it either.  You need not define this macro if all
  499.      constants (including `SYMBOL_REF') can be immediate operands when
  500.      generating position independent code.
  501.  
  502. File: gcc.info,  Node: Assembler Format,  Next: Debugging Info,  Prev: PIC,  Up: Target Macros
  503.  
  504. Defining the Output Assembler Language
  505. ======================================
  506.  
  507.    This section describes macros whose principal purpose is to describe
  508. how to write instructions in assembler language-rather than what the
  509. instructions do.
  510.  
  511. * Menu:
  512.  
  513. * File Framework::       Structural information for the assembler file.
  514. * Data Output::          Output of constants (numbers, strings, addresses).
  515. * Uninitialized Data::   Output of uninitialized variables.
  516. * Label Output::         Output and generation of labels.
  517. * Initialization::       General principles of initialization
  518.                and termination routines.
  519. * Macros for Initialization::
  520.              Specific macros that control the handling of
  521.                initialization and termination routines.
  522. * Instruction Output::   Output of actual instructions.
  523. * Dispatch Tables::      Output of jump tables.
  524. * Alignment Output::     Pseudo ops for alignment and skipping data.
  525.  
  526. File: gcc.info,  Node: File Framework,  Next: Data Output,  Up: Assembler Format
  527.  
  528. The Overall Framework of an Assembler File
  529. ------------------------------------------
  530.  
  531. `ASM_FILE_START (STREAM)'
  532.      A C expression which outputs to the stdio stream STREAM some
  533.      appropriate text to go at the start of an assembler file.
  534.  
  535.      Normally this macro is defined to output a line containing
  536.      `#NO_APP', which is a comment that has no effect on most
  537.      assemblers but tells the GNU assembler that it can save time by not
  538.      checking for certain assembler constructs.
  539.  
  540.      On systems that use SDB, it is necessary to output certain
  541.      commands; see `attasm.h'.
  542.  
  543. `ASM_FILE_END (STREAM)'
  544.      A C expression which outputs to the stdio stream STREAM some
  545.      appropriate text to go at the end of an assembler file.
  546.  
  547.      If this macro is not defined, the default is to output nothing
  548.      special at the end of the file.  Most systems don't require any
  549.      definition.
  550.  
  551.      On systems that use SDB, it is necessary to output certain
  552.      commands; see `attasm.h'.
  553.  
  554. `ASM_IDENTIFY_GCC (FILE)'
  555.      A C statement to output assembler commands which will identify the
  556.      object file as having been compiled with GNU CC (or another GNU
  557.      compiler).
  558.  
  559.      If you don't define this macro, the string `gcc_compiled.:' is
  560.      output.  This string is calculated to define a symbol which, on
  561.      BSD systems, will never be defined for any other reason.  GDB
  562.      checks for the presence of this symbol when reading the symbol
  563.      table of an executable.
  564.  
  565.      On non-BSD systems, you must arrange communication with GDB in
  566.      some other fashion.  If GDB is not used on your system, you can
  567.      define this macro with an empty body.
  568.  
  569. `ASM_COMMENT_START'
  570.      A C string constant describing how to begin a comment in the target
  571.      assembler language.  The compiler assumes that the comment will
  572.      end at the end of the line.
  573.  
  574. `ASM_APP_ON'
  575.      A C string constant for text to be output before each `asm'
  576.      statement or group of consecutive ones.  Normally this is
  577.      `"#APP"', which is a comment that has no effect on most assemblers
  578.      but tells the GNU assembler that it must check the lines that
  579.      follow for all valid assembler constructs.
  580.  
  581. `ASM_APP_OFF'
  582.      A C string constant for text to be output after each `asm'
  583.      statement or group of consecutive ones.  Normally this is
  584.      `"#NO_APP"', which tells the GNU assembler to resume making the
  585.      time-saving assumptions that are valid for ordinary compiler
  586.      output.
  587.  
  588. `ASM_OUTPUT_SOURCE_FILENAME (STREAM, NAME)'
  589.      A C statement to output COFF information or DWARF debugging
  590.      information which indicates that filename NAME is the current
  591.      source file to the stdio stream STREAM.
  592.  
  593.      This macro need not be defined if the standard form of output for
  594.      the file format in use is appropriate.
  595.  
  596. `ASM_OUTPUT_SOURCE_LINE (STREAM, LINE)'
  597.      A C statement to output DBX or SDB debugging information before
  598.      code for line number LINE of the current source file to the stdio
  599.      stream STREAM.
  600.  
  601.      This macro need not be defined if the standard form of debugging
  602.      information for the debugger in use is appropriate.
  603.  
  604. `ASM_OUTPUT_IDENT (STREAM, STRING)'
  605.      A C statement to output something to the assembler file to handle a
  606.      `#ident' directive containing the text STRING.  If this macro is
  607.      not defined, nothing is output for a `#ident' directive.
  608.  
  609. `ASM_OUTPUT_SECTION_NAME (STREAM, STRING)'
  610.      A C statement to output something to the assembler file to switch
  611.      to the section contained in STRING.  Some target formats do not
  612.      support arbitrary sections.  Do not define this macro in such
  613.      cases.
  614.  
  615.      At present this macro is only used to support section attributes.
  616.      When this macro is undefined, section attributes are disabled.
  617.  
  618. `OBJC_PROLOGUE'
  619.      A C statement to output any assembler statements which are
  620.      required to precede any Objective C object definitions or message
  621.      sending.  The statement is executed only when compiling an
  622.      Objective C program.
  623.  
  624. File: gcc.info,  Node: Data Output,  Next: Uninitialized Data,  Prev: File Framework,  Up: Assembler Format
  625.  
  626. Output of Data
  627. --------------
  628.  
  629. `ASM_OUTPUT_LONG_DOUBLE (STREAM, VALUE)'
  630. `ASM_OUTPUT_DOUBLE (STREAM, VALUE)'
  631. `ASM_OUTPUT_FLOAT (STREAM, VALUE)'
  632. `ASM_OUTPUT_THREE_QUARTER_FLOAT (STREAM, VALUE)'
  633. `ASM_OUTPUT_SHORT_FLOAT (STREAM, VALUE)'
  634. `ASM_OUTPUT_BYTE_FLOAT (STREAM, VALUE)'
  635.      A C statement to output to the stdio stream STREAM an assembler
  636.      instruction to assemble a floating-point constant of `TFmode',
  637.      `DFmode', `SFmode', `TQFmode', `HFmode', or `QFmode',
  638.      respectively, whose value is VALUE.  VALUE will be a C expression
  639.      of type `REAL_VALUE_TYPE'.  Macros such as
  640.      `REAL_VALUE_TO_TARGET_DOUBLE' are useful for writing these
  641.      definitions.
  642.  
  643. `ASM_OUTPUT_QUADRUPLE_INT (STREAM, EXP)'
  644. `ASM_OUTPUT_DOUBLE_INT (STREAM, EXP)'
  645. `ASM_OUTPUT_INT (STREAM, EXP)'
  646. `ASM_OUTPUT_SHORT (STREAM, EXP)'
  647. `ASM_OUTPUT_CHAR (STREAM, EXP)'
  648.      A C statement to output to the stdio stream STREAM an assembler
  649.      instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
  650.      respectively, whose value is VALUE.  The argument EXP will be an
  651.      RTL expression which represents a constant value.  Use
  652.      `output_addr_const (STREAM, EXP)' to output this value as an
  653.      assembler expression.
  654.  
  655.      For sizes larger than `UNITS_PER_WORD', if the action of a macro
  656.      would be identical to repeatedly calling the macro corresponding to
  657.      a size of `UNITS_PER_WORD', once for each word, you need not define
  658.      the macro.
  659.  
  660. `ASM_OUTPUT_BYTE (STREAM, VALUE)'
  661.      A C statement to output to the stdio stream STREAM an assembler
  662.      instruction to assemble a single byte containing the number VALUE.
  663.  
  664. `ASM_BYTE_OP'
  665.      A C string constant giving the pseudo-op to use for a sequence of
  666.      single-byte constants.  If this macro is not defined, the default
  667.      is `"byte"'.
  668.  
  669. `ASM_OUTPUT_ASCII (STREAM, PTR, LEN)'
  670.      A C statement to output to the stdio stream STREAM an assembler
  671.      instruction to assemble a string constant containing the LEN bytes
  672.      at PTR.  PTR will be a C expression of type `char *' and LEN a C
  673.      expression of type `int'.
  674.  
  675.      If the assembler has a `.ascii' pseudo-op as found in the Berkeley
  676.      Unix assembler, do not define the macro `ASM_OUTPUT_ASCII'.
  677.  
  678. `ASM_OUTPUT_POOL_PROLOGUE (FILE FUNNAME FUNDECL SIZE)'
  679.      A C statement to output assembler commands to define the start of
  680.      the constant pool for a function.  FUNNAME is a string giving the
  681.      name of the function.  Should the return type of the function be
  682.      required, it can be obtained via FUNDECL.  SIZE is the size, in
  683.      bytes, of the constant pool that will be written immediately after
  684.      this call.
  685.  
  686.      If no constant-pool prefix is required, the usual case, this macro
  687.      need not be defined.
  688.  
  689. `ASM_OUTPUT_SPECIAL_POOL_ENTRY (FILE, X, MODE, ALIGN, LABELNO, JUMPTO)'
  690.      A C statement (with or without semicolon) to output a constant in
  691.      the constant pool, if it needs special treatment.  (This macro
  692.      need not do anything for RTL expressions that can be output
  693.      normally.)
  694.  
  695.      The argument FILE is the standard I/O stream to output the
  696.      assembler code on.  X is the RTL expression for the constant to
  697.      output, and MODE is the machine mode (in case X is a `const_int').
  698.      ALIGN is the required alignment for the value X; you should
  699.      output an assembler directive to force this much alignment.
  700.  
  701.      The argument LABELNO is a number to use in an internal label for
  702.      the address of this pool entry.  The definition of this macro is
  703.      responsible for outputting the label definition at the proper
  704.      place.  Here is how to do this:
  705.  
  706.           ASM_OUTPUT_INTERNAL_LABEL (FILE, "LC", LABELNO);
  707.  
  708.      When you output a pool entry specially, you should end with a
  709.      `goto' to the label JUMPTO.  This will prevent the same pool entry
  710.      from being output a second time in the usual manner.
  711.  
  712.      You need not define this macro if it would do nothing.
  713.  
  714. `IS_ASM_LOGICAL_LINE_SEPARATOR (C)'
  715.      Define this macro as a C expression which is nonzero if C is used
  716.      as a logical line separator by the assembler.
  717.  
  718.      If you do not define this macro, the default is that only the
  719.      character `;' is treated as a logical line separator.
  720.  
  721. `ASM_OPEN_PAREN'
  722. `ASM_CLOSE_PAREN'
  723.      These macros are defined as C string constant, describing the
  724.      syntax in the assembler for grouping arithmetic expressions.  The
  725.      following definitions are correct for most assemblers:
  726.  
  727.           #define ASM_OPEN_PAREN "("
  728.           #define ASM_CLOSE_PAREN ")"
  729.  
  730.    These macros are provided by `real.h' for writing the definitions of
  731. `ASM_OUTPUT_DOUBLE' and the like:
  732.  
  733. `REAL_VALUE_TO_TARGET_SINGLE (X, L)'
  734. `REAL_VALUE_TO_TARGET_DOUBLE (X, L)'
  735. `REAL_VALUE_TO_TARGET_LONG_DOUBLE (X, L)'
  736.      These translate X, of type `REAL_VALUE_TYPE', to the target's
  737.      floating point representation, and store its bit pattern in the
  738.      array of `long int' whose address is L.  The number of elements in
  739.      the output array is determined by the size of the desired target
  740.      floating point data type: 32 bits of it go in each `long int' array
  741.      element.  Each array element holds 32 bits of the result, even if
  742.      `long int' is wider than 32 bits on the host machine.
  743.  
  744.      The array element values are designed so that you can print them
  745.      out using `fprintf' in the order they should appear in the target
  746.      machine's memory.
  747.  
  748. `REAL_VALUE_TO_DECIMAL (X, FORMAT, STRING)'
  749.      This macro converts X, of type `REAL_VALUE_TYPE', to a decimal
  750.      number and stores it as a string into STRING.  You must pass, as
  751.      STRING, the address of a long enough block of space to hold the
  752.      result.
  753.  
  754.      The argument FORMAT is a `printf'-specification that serves as a
  755.      suggestion for how to format the output string.
  756.  
  757. File: gcc.info,  Node: Uninitialized Data,  Next: Label Output,  Prev: Data Output,  Up: Assembler Format
  758.  
  759. Output of Uninitialized Variables
  760. ---------------------------------
  761.  
  762.    Each of the macros in this section is used to do the whole job of
  763. outputting a single uninitialized variable.
  764.  
  765. `ASM_OUTPUT_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  766.      A C statement (sans semicolon) to output to the stdio stream
  767.      STREAM the assembler definition of a common-label named NAME whose
  768.      size is SIZE bytes.  The variable ROUNDED is the size rounded up
  769.      to whatever alignment the caller wants.
  770.  
  771.      Use the expression `assemble_name (STREAM, NAME)' to output the
  772.      name itself; before and after that, output the additional
  773.      assembler syntax for defining the name, and a newline.
  774.  
  775.      This macro controls how the assembler definitions of uninitialized
  776.      global variables are output.
  777.  
  778. `ASM_OUTPUT_ALIGNED_COMMON (STREAM, NAME, SIZE, ALIGNMENT)'
  779.      Like `ASM_OUTPUT_COMMON' except takes the required alignment as a
  780.      separate, explicit argument.  If you define this macro, it is used
  781.      in place of `ASM_OUTPUT_COMMON', and gives you more flexibility in
  782.      handling the required alignment of the variable.  The alignment is
  783.      specified as the number of bits.
  784.  
  785. `ASM_OUTPUT_SHARED_COMMON (STREAM, NAME, SIZE, ROUNDED)'
  786.      If defined, it is similar to `ASM_OUTPUT_COMMON', except that it
  787.      is used when NAME is shared.  If not defined, `ASM_OUTPUT_COMMON'
  788.      will be used.
  789.  
  790. `ASM_OUTPUT_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  791.      A C statement (sans semicolon) to output to the stdio stream
  792.      STREAM the assembler definition of a local-common-label named NAME
  793.      whose size is SIZE bytes.  The variable ROUNDED is the size
  794.      rounded up to whatever alignment the caller wants.
  795.  
  796.      Use the expression `assemble_name (STREAM, NAME)' to output the
  797.      name itself; before and after that, output the additional
  798.      assembler syntax for defining the name, and a newline.
  799.  
  800.      This macro controls how the assembler definitions of uninitialized
  801.      static variables are output.
  802.  
  803. `ASM_OUTPUT_ALIGNED_LOCAL (STREAM, NAME, SIZE, ALIGNMENT)'
  804.      Like `ASM_OUTPUT_LOCAL' except takes the required alignment as a
  805.      separate, explicit argument.  If you define this macro, it is used
  806.      in place of `ASM_OUTPUT_LOCAL', and gives you more flexibility in
  807.      handling the required alignment of the variable.  The alignment is
  808.      specified as the number of bits.
  809.  
  810. `ASM_OUTPUT_SHARED_LOCAL (STREAM, NAME, SIZE, ROUNDED)'
  811.      If defined, it is similar to `ASM_OUTPUT_LOCAL', except that it is
  812.      used when NAME is shared.  If not defined, `ASM_OUTPUT_LOCAL' will
  813.      be used.
  814.  
  815. File: gcc.info,  Node: Label Output,  Next: Initialization,  Prev: Uninitialized Data,  Up: Assembler Format
  816.  
  817. Output and Generation of Labels
  818. -------------------------------
  819.  
  820. `ASM_OUTPUT_LABEL (STREAM, NAME)'
  821.      A C statement (sans semicolon) to output to the stdio stream
  822.      STREAM the assembler definition of a label named NAME.  Use the
  823.      expression `assemble_name (STREAM, NAME)' to output the name
  824.      itself; before and after that, output the additional assembler
  825.      syntax for defining the name, and a newline.
  826.  
  827. `ASM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL)'
  828.      A C statement (sans semicolon) to output to the stdio stream
  829.      STREAM any text necessary for declaring the name NAME of a
  830.      function which is being defined.  This macro is responsible for
  831.      outputting the label definition (perhaps using
  832.      `ASM_OUTPUT_LABEL').  The argument DECL is the `FUNCTION_DECL'
  833.      tree node representing the function.
  834.  
  835.      If this macro is not defined, then the function name is defined in
  836.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  837.  
  838. `ASM_DECLARE_FUNCTION_SIZE (STREAM, NAME, DECL)'
  839.      A C statement (sans semicolon) to output to the stdio stream
  840.      STREAM any text necessary for declaring the size of a function
  841.      which is being defined.  The argument NAME is the name of the
  842.      function.  The argument DECL is the `FUNCTION_DECL' tree node
  843.      representing the function.
  844.  
  845.      If this macro is not defined, then the function size is not
  846.      defined.
  847.  
  848. `ASM_DECLARE_OBJECT_NAME (STREAM, NAME, DECL)'
  849.      A C statement (sans semicolon) to output to the stdio stream
  850.      STREAM any text necessary for declaring the name NAME of an
  851.      initialized variable which is being defined.  This macro must
  852.      output the label definition (perhaps using `ASM_OUTPUT_LABEL').
  853.      The argument DECL is the `VAR_DECL' tree node representing the
  854.      variable.
  855.  
  856.      If this macro is not defined, then the variable name is defined in
  857.      the usual manner as a label (by means of `ASM_OUTPUT_LABEL').
  858.  
  859. `ASM_FINISH_DECLARE_OBJECT (STREAM, DECL, TOPLEVEL, ATEND)'
  860.      A C statement (sans semicolon) to finish up declaring a variable
  861.      name once the compiler has processed its initializer fully and
  862.      thus has had a chance to determine the size of an array when
  863.      controlled by an initializer.  This is used on systems where it's
  864.      necessary to declare something about the size of the object.
  865.  
  866.      If you don't define this macro, that is equivalent to defining it
  867.      to do nothing.
  868.  
  869. `ASM_GLOBALIZE_LABEL (STREAM, NAME)'
  870.      A C statement (sans semicolon) to output to the stdio stream
  871.      STREAM some commands that will make the label NAME global; that
  872.      is, available for reference from other files.  Use the expression
  873.      `assemble_name (STREAM, NAME)' to output the name itself; before
  874.      and after that, output the additional assembler syntax for making
  875.      that name global, and a newline.
  876.  
  877. `ASM_OUTPUT_EXTERNAL (STREAM, DECL, NAME)'
  878.      A C statement (sans semicolon) to output to the stdio stream
  879.      STREAM any text necessary for declaring the name of an external
  880.      symbol named NAME which is referenced in this compilation but not
  881.      defined.  The value of DECL is the tree node for the declaration.
  882.  
  883.      This macro need not be defined if it does not need to output
  884.      anything.  The GNU assembler and most Unix assemblers don't
  885.      require anything.
  886.  
  887. `ASM_OUTPUT_EXTERNAL_LIBCALL (STREAM, SYMREF)'
  888.      A C statement (sans semicolon) to output on STREAM an assembler
  889.      pseudo-op to declare a library function name external.  The name
  890.      of the library function is given by SYMREF, which has type `rtx'
  891.      and is a `symbol_ref'.
  892.  
  893.      This macro need not be defined if it does not need to output
  894.      anything.  The GNU assembler and most Unix assemblers don't
  895.      require anything.
  896.  
  897. `ASM_OUTPUT_LABELREF (STREAM, NAME)'
  898.      A C statement (sans semicolon) to output to the stdio stream
  899.      STREAM a reference in assembler syntax to a label named NAME.
  900.      This should add `_' to the front of the name, if that is customary
  901.      on your operating system, as it is in most Berkeley Unix systems.
  902.      This macro is used in `assemble_name'.
  903.  
  904. `ASM_OUTPUT_INTERNAL_LABEL (STREAM, PREFIX, NUM)'
  905.      A C statement to output to the stdio stream STREAM a label whose
  906.      name is made from the string PREFIX and the number NUM.
  907.  
  908.      It is absolutely essential that these labels be distinct from the
  909.      labels used for user-level functions and variables.  Otherwise,
  910.      certain programs will have name conflicts with internal labels.
  911.  
  912.      It is desirable to exclude internal labels from the symbol table
  913.      of the object file.  Most assemblers have a naming convention for
  914.      labels that should be excluded; on many systems, the letter `L' at
  915.      the beginning of a label has this effect.  You should find out what
  916.      convention your system uses, and follow it.
  917.  
  918.      The usual definition of this macro is as follows:
  919.  
  920.           fprintf (STREAM, "L%s%d:\n", PREFIX, NUM)
  921.  
  922. `ASM_GENERATE_INTERNAL_LABEL (STRING, PREFIX, NUM)'
  923.      A C statement to store into the string STRING a label whose name
  924.      is made from the string PREFIX and the number NUM.
  925.  
  926.      This string, when output subsequently by `assemble_name', should
  927.      produce the output that `ASM_OUTPUT_INTERNAL_LABEL' would produce
  928.      with the same PREFIX and NUM.
  929.  
  930.      If the string begins with `*', then `assemble_name' will output
  931.      the rest of the string unchanged.  It is often convenient for
  932.      `ASM_GENERATE_INTERNAL_LABEL' to use `*' in this way.  If the
  933.      string doesn't start with `*', then `ASM_OUTPUT_LABELREF' gets to
  934.      output the string, and may change it.  (Of course,
  935.      `ASM_OUTPUT_LABELREF' is also part of your machine description, so
  936.      you should know what it does on your machine.)
  937.  
  938. `ASM_FORMAT_PRIVATE_NAME (OUTVAR, NAME, NUMBER)'
  939.      A C expression to assign to OUTVAR (which is a variable of type
  940.      `char *') a newly allocated string made from the string NAME and
  941.      the number NUMBER, with some suitable punctuation added.  Use
  942.      `alloca' to get space for the string.
  943.  
  944.      The string will be used as an argument to `ASM_OUTPUT_LABELREF' to
  945.      produce an assembler label for an internal static variable whose
  946.      name is NAME.  Therefore, the string must be such as to result in
  947.      valid assembler code.  The argument NUMBER is different each time
  948.      this macro is executed; it prevents conflicts between
  949.      similarly-named internal static variables in different scopes.
  950.  
  951.      Ideally this string should not be a valid C identifier, to prevent
  952.      any conflict with the user's own symbols.  Most assemblers allow
  953.      periods or percent signs in assembler symbols; putting at least
  954.      one of these between the name and the number will suffice.
  955.  
  956. `ASM_OUTPUT_DEF (STREAM, NAME, VALUE)'
  957.      A C statement to output to the stdio stream STREAM assembler code
  958.      which defines (equates) the symbol NAME to have the value VALUE.
  959.  
  960.      If SET_ASM_OP is defined, a default definition is provided which is
  961.      correct for most systems.
  962.  
  963. `OBJC_GEN_METHOD_LABEL (BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME)'
  964.      Define this macro to override the default assembler names used for
  965.      Objective C methods.
  966.  
  967.      The default name is a unique method number followed by the name of
  968.      the class (e.g. `_1_Foo').  For methods in categories, the name of
  969.      the category is also included in the assembler name (e.g.
  970.      `_1_Foo_Bar').
  971.  
  972.      These names are safe on most systems, but make debugging difficult
  973.      since the method's selector is not present in the name.
  974.      Therefore, particular systems define other ways of computing names.
  975.  
  976.      BUF is an expression of type `char *' which gives you a buffer in
  977.      which to store the name; its length is as long as CLASS_NAME,
  978.      CAT_NAME and SEL_NAME put together, plus 50 characters extra.
  979.  
  980.      The argument IS_INST specifies whether the method is an instance
  981.      method or a class method; CLASS_NAME is the name of the class;
  982.      CAT_NAME is the name of the category (or NULL if the method is not
  983.      in a category); and SEL_NAME is the name of the selector.
  984.  
  985.      On systems where the assembler can handle quoted names, you can
  986.      use this macro to provide more human-readable names.
  987.  
  988.